  //
//  BaseNetWorkViewController.m
//  HuaMuJinRong
//
//  Created by Cindy on 16/5/25.
//  Copyright © 2016年 EIMS. All rights reserved.
//

#import "BaseNetWorkViewController.h"

@interface BaseNetWorkViewController ()
{
    KSNoNetView *_noNetworkView;
}
@end

@implementation BaseNetWorkViewController

- (void)showNonetWork
{
    if (_noNetworkView == nil)
    {
        _noNetworkView = [KSNoNetView instanceNoNetView];
        _noNetworkView.delegate = self;
        _noNetworkView.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);
        [self.view addSubview:_noNetworkView];
    }

}
- (void)hiddenNonetWork
{
    for (UIView* view in self.view.subviews) {
        if ([view isKindOfClass:[KSNoNetView class]]) {
            [view removeFromSuperview];
        }
    }
}
- (void)reloadNetworkDataSource:(id)sender
{
    if ([self respondsToSelector:@selector(reloadRequest)]) {
        [self performSelector:@selector(reloadRequest)];
    }
}

#pragma mark - 请求数据
- (void)reloadRequest
{
    //NSLog(@"必须由网络控制器(%@)重写这个方法(%@)，才可以使用再次刷新网络",NSStringFromClass([self class]),NSStringFromSelector(@selector(reloadRequest)));
    
    [self requestData];
}

#pragma mark - 请求数据
- (void)requestData
{
    
}

#pragma mark - HTTPClientDelegate
-(void) startRequest
{
    
}

-(void) httpResponseSuccess:(NetWorkClient *)client dataTask:(NSURLSessionDataTask *)task didSuccessWithObject:(id)obj
{
   
}


-(void) httpResponseFailure:(NetWorkClient *)client dataTask:(NSURLSessionDataTask *)task didFailWithError:(NSError *)error
{
    //[SVProgressHUD showErrorWithStatus:@"连接服务器失败，请稍后再试"];
    
}

-(void) networkError
{
   // [SVProgressHUD showErrorWithStatus:@"网络不给力，请检查您的网络设置"];
}



@end
